package io.bluerain.fragment.ui.entities;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by foredawn on 15-9-21.
 * fragment填充实体模型
 */
public class BookContent {

    public static List<Book> ITEMS = new ArrayList<>();
    public static Map<Integer, Book> ITEMS_MAP = new HashMap<>();

    public static class Book {
        public Integer id;
        public String title;
        public String desc;

        public Book(Integer id, String title, String desc) {
            this.id = id;
            this.title = title;
            this.desc = desc;
        }

        @Override
        public String toString() {
            return this.title;
        }

    }

    static {
        addItem(new Book(0, "疯狂安卓讲义", "一本还不错的安卓开发书籍"));
        addItem(new Book(1, "疯狂Java讲义", "很全的java语言基础书籍"));
    }

    static void addItem(Book book) {
        ITEMS.add(book);
        ITEMS_MAP.put(book.id, book);
    }
}
